# coding:utf8
# 弗波那契数列

def meno(fn):
    cache = {}

    def warp(*args):
        if args not in cache:
            cache[args] = fn(*args)
            print cache
        return cache[args]

    return warp


@meno
def fanb(n):
    if n <= 2:
        return 1
    else:
        return fanb(n - 1) + fanb(n - 2)


#print fanb(70)


# 一共10个台阶，一次只能走1-3个且不能后退   走完台阶一共有多少方法
@meno
def climb(n, steps):
    count = 0
    if n == 0:
        count += 1
    elif n > 0:
        for step in steps:
            count += climb(n - step, steps)
    return count



print climb(100, (1, 2, 3))
